package com.maiyuren.fishkit.ui.components

import android.os.Build
import androidx.annotation.RequiresApi
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.maiyuren.fishkit.ui.theme.DisableColor
import com.maiyuren.fishkit.utils.FishFonts

@RequiresApi(Build.VERSION_CODES.Q)
@Composable
fun FishIconButton(
    modifier: Modifier = Modifier,
    icon:String,
    enabled: Boolean = true,
    padding: PaddingValues = PaddingValues(8.dp),
    fontSize: TextUnit = 26.sp,
    onClick: (() -> Unit)? = null
    ) {
    Text(
        modifier = modifier
            .clickable(onClick = {
                if (enabled && onClick != null) onClick()
            })
            .padding(padding),
        text = icon,
        fontSize = fontSize,
        fontFamily = FishFonts.IconFont,
        color = (if (enabled) Color.Black else DisableColor)
    )
}